package com.lianzhihui.romeex.adapter;

import android.content.Context;
import android.widget.TextView;

import androidx.annotation.NonNull;
import androidx.annotation.Nullable;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.lianzhihui.romeex.MyApplication;
import com.lianzhihui.romeex.R;
import com.lianzhihui.romeex.bean.FirstMinnerFindRecordInfoBean;
import com.lianzhihui.romeex.utils.DateUtil;

import java.util.List;

/**
 * Description: 主页适配器
 * Author: RAMON
 * CreateDate: 2020/11/4 8:10 PM
 * UpdateUser:
 * UpdateDate:
 * UpdateRemark:
 * Version:
 */
public class BaiZhanTingActivityAdapter extends BaseQuickAdapter<FirstMinnerFindRecordInfoBean.ContentBean, BaseViewHolder> {

    Context mContext;

    public BaiZhanTingActivityAdapter(@Nullable Context mContext, @Nullable List<FirstMinnerFindRecordInfoBean.ContentBean> data) {
        super(R.layout.item_baizhanting_layout, data);
        this.mContext = mContext;
    }

    @Override
    protected void convert(@NonNull BaseViewHolder helper, FirstMinnerFindRecordInfoBean.ContentBean item) {

        helper.setText(R.id.reward, item.getReward() + MyApplication.mContext.getResources().getString(R.string.text_rex));
        TextView tv = helper.getView(R.id.isGrant);
        if (item.getIsGrant() == 0) {
            //0 未发放
            tv.setText(mContext.getString(R.string.text_not_issued));
            helper.setText(R.id.time, DateUtil.sec2Date(item.getTimestamp()));
            tv.setTextColor(mContext.getResources().getColor(R.color.text_cccccc_color));
        } else {
            // 1 已发放
            tv.setText(mContext.getResources().getString(R.string.text_issued));
            helper.setText(R.id.time, DateUtil.sec2Date(item.getGrantTimestamp()));
            tv.setTextColor(mContext.getResources().getColor(R.color.text_F3863B_color));
        }

    }
}
